package com.example.evanproject.controller;

import com.example.evanproject.service.CourseService;
import com.example.evanproject.service.CoursechapterService;
import com.example.evanproject.service.impl.CourseServiceImpl;
import com.example.evanproject.service.impl.CoursechapterServiceImpl;
import com.example.evanproject.service.impl.CourselessonServiceImpl;
import com.example.evanproject.service.impl.CoursemoduleServiceImpl;
import com.example.evanproject.util.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@CrossOrigin
@RequestMapping("courseInfo")
public class CourseInfoController {

    @Autowired
    private CourseServiceImpl courseService;
    @Autowired
    private CourselessonServiceImpl courselessonService;
    @Autowired
    private CoursemoduleServiceImpl coursemoduleService;
    @Autowired
    private CoursechapterServiceImpl coursechapterService;

//    删除课时信息
    @RequestMapping("deleteInfo")
    public AjaxResult deleteInfo(Integer id,Integer type){
        Boolean num = null;
        if(type==2){

  num=coursechapterService.removeById(id);
        }
if(type==3){
    num=coursemoduleService.removeById(id);
}
        if(type==4){
          num=courselessonService.removeById(id);
        }

        return AjaxResult.success(num);
    }
}
